package com.aaa.util;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author: hy
 */
@Configuration
public class UploadConfig implements WebMvcConfigurer {
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        //针对请求包含 /upload 路径的，到磁盘指定的目录中 e:/upload/ 输出对应的访问资源
        registry.addResourceHandler("/upload/**")
                .addResourceLocations("file:e:/upload/");
    }
}